package com.atguigu;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;

@WebServlet("/servlet3")
public class servlet3 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext servletContext = getServletContext();
        //获取某个项目部署位置下的某个文件/目录的磁盘真是路径的api
        String path=servletContext.getRealPath("upload");
        System.out.println(path);
        FileOutputStream fos = new FileOutputStream(path+"a.txt");
    }
}
